//
//  WbComposeButton.swift
//  Weibo
//
//  Created by HH on 16/12/9.
//  Copyright © 2016年 Weibo. All rights reserved.
//

import UIKit

class WbComposeButton: UIButton {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        titleLabel?.textAlignment = .center
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //需要空实现该方法,不然点击按钮的时候会走layoutSubViews这个方法
    override var isHighlighted: Bool{
        
        set{
            
        } get{
            return false
        }
        
    }
    
    //在该方法中调整系统子控件的位置
    override func layoutSubviews() {
        super.layoutSubviews()
        
        imageView?.width = width
        
        imageView?.height = width
        
        imageView?.x = 0
        
        imageView?.y = 0
        
        
        titleLabel?.x = 0
        
        titleLabel?.y = width + 5
        
        titleLabel?.width = width
        
        titleLabel?.height = height - width
        
    }
    

}
